- console.log('procs:',procs);
h3 Models (BPMN Definitions)
	script(type="text/javascript").

		var currentProcess="";
		var selectedProcess,userId;

		$(window).on('pageshow', function(){

			if (!$("#process").val())
			{
				$("#process").val($("#process option:first").val());
			}

			
			selectedProcess = $("#process").val();
			$("#svg").attr("src", "/model/getSVg/"+selectedProcess);
			setLinks();

		});

		$(document).ready(function(){
			userId=$("userId").val();

			$("#process").change(function(){
				selectedProcess = $(this).children("option:selected").val();
				$("#svg").attr("src", "/model/getSVg/"+selectedProcess);
				setLinks();
			});
			$("#userId").change(function(){
				var userId=$(this).val();
				  $.get("userId?userId="+userId, function(data, status){
						});
			});
			$("#userId").keyup(function(){
				userId=$(this).val();
				setLinks();
			});
			$("#process")[0].value = currentProcess;
		});
		function setLinks()
		{
			if (selectedProcess)
				{
				var ext=selectedProcess+"/?userId="+userId;

				$('#execLink').attr("href","/execute/"+ext);
				$('#execButton').attr("value","/execute/"+ext);
				$('#execInputLink').attr("href","/executeInput/"+ext);
				$('#modelLink').attr("href","/model/edit/"+ext);
				$('#deleteLink').attr("href","/model/delete/"+ext);
				$('#renameLink').attr("href","/model/rename/"+ext);
				}
		}

div(id="processes")
	table
		tr 
			a(vertical-align="top")
			form(name='ExecuteForm',action="/execute",method="post")
				input(type='hidden',name='processName',id='processName')
				td
					table
						tr
							td

								select(id='process',size=18)
									each proc in procs
										option #{proc.name}
										a value #{proc.name}

						tr
							td

				td
					div(id="image",style="overflow:auto;")
						image(id="svg",alt="No image to display",style="max-width: 100%;max-height: 270px;padding: 0;margin: 0;background: lightgray;")


div(id="actions")
	table
		tr 
			a(vertical-align="top")
			form(name='ExecuteForm',action="/execute",method="post")
				input(type='hidden',name='processName',id='processName')
				td
					table(class="buttonsTable")
						tr
							td  
								a(id='execLink',href="javascript:alert('please select a Process');") 
									div Execute
						tr
							td  
								a(id='execInputLink',href="javascript:alert('please select a Process');") 
									div Execute with Options
						tr
							td  
								a(id='modelLink',href="javascript:alert('please select a Process');")
									div Model
				td
					table(class="buttonsTable")
						tr
							td  
									a(id='deleteLink',href="javascript:alert('please select a Process');")
										div Delete
						tr
							td  
									a(id='renameLink',href="javascript:alert('please select a Process');")
										div Rename
				td
					table(class="buttonsTable")
						tr
							td  
									a(href="/model/new")
										div New Model
						tr
							td  
									a(href="/model/import") 
										div Import
						tr
							td  
									a(href="/model/export") 
										div Export
